package store.lunangangster.engine.impl.query;

import java.util.List;
import store.lunangangster.engine.impl.cmd.CommandExecutor;
import store.lunangangster.engine.impl.entity.ProcessDefinitionEntity;
import store.lunangangster.engine.impl.interceptor.CommandContext;

public class ProcessDefinitionQueryImpl extends AbstractQuery<ProcessDefinitionQuery, ProcessDefinitionEntity> implements ProcessDefinitionQuery{

  protected String id;
  protected String key;
  protected String deploymentId;
  protected String name;
  protected String documentation;
  protected int version;

  public ProcessDefinitionQueryImpl(CommandExecutor executor) {
    super(executor);
  }

  @Override
  protected List<ProcessDefinitionEntity> queryList(CommandContext commandContext) {
    return commandContext.getProcessEngineConfiguration().getProcessDefinitionEntityManager().selectProcessDefinitionByCondition(this);
  }

  @Override
  protected Page<ProcessDefinitionEntity> queryPage(CommandContext commandContext) {
    return null;
  }

  @Override
  protected int queryCount(CommandContext commandContext) {
    return commandContext.getProcessEngineConfiguration().getProcessDefinitionEntityManager().selectCount(this);
  }

  @Override
  public ProcessDefinitionQuery id(String id) {
    this.id = id;
    return this;
  }

  @Override
  public ProcessDefinitionQuery key(String key) {
    this.key = key;
    return this;
  }

  @Override
  public ProcessDefinitionQuery deploymentId(String deploymentId) {
    this.deploymentId = deploymentId;
    return this;
  }

  @Override
  public ProcessDefinitionQuery name(String name) {
    this.name = name;
    return this;
  }

  @Override
  public ProcessDefinitionQuery documentation(String documentation) {
    this.documentation = documentation;
    return this;
  }

  @Override
  public ProcessDefinitionQuery version(int version) {
    this.version = version;
    return this;
  }
}
